/*
 ------------------------------------------------------------------------------
	winmad++ -	a test program for using SDL and mad library on Windows
				with object oriented UI style
				with low level mad (seek)

	Copyright (C) 2011 Pierre Veber
	
	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 3 of the License, or
	(at your option) any later version.
	
	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
	
	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software Foundation,
	Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
------------------------------------------------------------------------------
*/

#include "precomp.h"

int main(int argc, char* argv[])
{
	CSDLApp* pApp = new CSDLApp("willy-player/PROOF/5", "height: 320px; width: 320px; background-image: url('res/app-background.png');");
	if (pApp != NULL)
	{
		CSDLText* pText = new CSDLText("Hello, world!", pApp, "width: 200px; height: 30px;");
		pText->setText("Hello, world! Let's see how it fits the whole page.");
		pApp->run(argv[1]);
	}
	delete pApp;
	return 0;
}

#ifdef _MSC_VER

#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "../common/mad/libmad.lib")
#pragma comment(lib, "../common/mad/libid3tag.lib")
#pragma comment(lib, "../common/sdl/SDL.lib")
#pragma comment(lib, "../common/sdl/SDL_ttf.lib")
#pragma comment(lib, "../common/sdl/SDL_image.lib")
#pragma comment(lib, "../common/zlib/zlib.lib")

static char* _argv[] = { "sdlmad++.exe", "" };
int APIENTRY _tWinMain(
			HINSTANCE hInstance,
			HINSTANCE hPrevInstance,
			LPTSTR    lpCmdLine,
			int       nCmdShow
			)
{
	/* convert command line to UTF-8 */
	char* pszCmdLine = (char*)malloc(_tcslen(lpCmdLine)+1);
	WideCharToMultiByte(CP_UTF8, 0, lpCmdLine, -1 ,pszCmdLine, _tcslen(lpCmdLine)+1, NULL, NULL);
	_argv[1] = pszCmdLine;
	return main(0, _argv);
}

#endif
